/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * EffectsButton.java
 *
 * Created on 2010-apr-16, 15:28:06
 */

package mvc.gui.impl;

import mvc.core.IMachuPicchu;
import mvc.effects.IEffect;

/**
 *
 * @author Berget
 */
@SuppressWarnings("serial")
public class EffectsButton extends javax.swing.JPanel {

    /** Creates new form EffectsButton */
    public EffectsButton(IMachuPicchu machu, IEffect effect) {
    	this.presenter = new EffectsButtonPresenter(machu, this);;
    	this.effect = effect;
    	
    	initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents() {

        jButton1 = new javax.swing.JButton();

        jButton1.setForeground(new java.awt.Color(0, 0, 0));
        jButton1.setText(effect.toString());
        jButton1.setBorderPainted(false);
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                applyEffectActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 82, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents

    private void applyEffectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_applyEffectActionPerformed
       presenter.applyEffect(effect);
    }//GEN-LAST:event_applyEffectActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    // End of variables declaration//GEN-END:variables
    private EffectsButtonPresenter presenter;
    private IEffect effect;
}
